package com.sky.controller.admin;

import com.sky.common.CommonHashMap;
import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author wangqi
 * @date 2024/1/2 15:18
 */
@RestController
@RequestMapping(value = {"/admin","/user"})
@Slf4j
public class ShopController {

    //请求路径：/admin/shop/{status}
    @PutMapping("/shop/{status}")
    public Result setStatus(@PathVariable Integer status){
        log.info("设置店铺状态：{}",status);
        CommonHashMap.setStatus(status);
        return Result.success();
    }

    @GetMapping("/shop/status")
    public Result<Integer> getStatus(){
        log.info("获取店铺状态：{}",CommonHashMap.getStatus());
        Integer status = CommonHashMap.getStatus();
        log.info("==返回店铺状态：{}",status);
        return Result.success(status);
    }
}
